package com.gome.boot.config.mq.annotation;

import com.gome.boot.config.mq.rocketmq.MQConstants;
import com.gome.boot.config.mq.rocketmq.MQDeleyLevel;
import com.gome.boot.config.mq.rocketmq.SerializeType;

import java.lang.annotation.*;

/**
 * Rocketmq config annotation of producer.
 *
 * @author baoxiufeng
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface MQProducer {

    /**
     * The value may indicate a suggestion for a logical component name,
     * to be turned into a Spring bean in case of an autodetected component.
     * @return the suggested component name, if any
     */
    String value() default "";

    /**
     * The diamond config group if using the diamond config framework.
     * Default is rocketmq.
     * @return the diamond config group name
     */
    String group() default MQConstants.DIAMOND_GROUP_ROCKETMQ_SERVER;

    /**
     * The diamond config data id if using the diamond config framework.
     * Default is url.
     * @return the diamond config data id
     */
    String dataId() default MQConstants.DIAMOND_DATAID_ROCKETMQ_SERVER;

    /**
     * When the value is true, means the topic and tag value is a config key.
     * Otherwise the topic and tag is the real rocketmq topic and tag, default is true.
     * @return the type of topic and tag.
     */
    boolean isConfigKey() default true;

    /**
     * When the isConfigKey is true, means a config key of topic.
     * Otherwise is the real rocketmq topic.
     * @return the topic or the config key of the topic.
     */
    String topic();

    /**
     * When the isConfigKey is true, means a config key of tag.
     * Otherwise is the real rocketmq tag.
     * @return the tag or the config key of the tag.
     */
    String tag();

    /**
     * When the orderley is true, means the queue is a orderly message queue.
     * Otherwise the queue is a concurrently message queue, default is false.
     * @return the type of message queue.
     */
    boolean orderly() default false;

    /**
     * Define the rocketmq message send delay level.
     * @return message delay level
     */
    MQDeleyLevel level() default MQDeleyLevel.LEVEL_0;

    /**
     * The serializable type of produce message, default is "FASTJSON".
     * @return the serializable type of produce message
     */
    SerializeType serializeType() default SerializeType.FASTJSON;
}
